"""
@author: xxw
@file: 判断ip地址是否合法.py
@time: 2023/5/31 19:36
"""
import re
ip = input("请输入ip地址:")
res = re.findall(r"^([1-9]|[1-9]\d|1\d{2}|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d{2}|2[0-4]\d|25[0-5])\. \2 \. \2$", ip)
if res:
    print("该ip地址合法")
else:
    print("该ip地址不合法")